//
//  UIButton+Extension.swift
//  weibo10
//
//  Created by 周荣硕 on 16/1/8.
//  Copyright © 2016年 grgbanking. All rights reserved.
//

import UIKit


extension UIButton{

    //便利构造函数
    ///  遍历构造函数
    ///
    ///  - parameter imageName:     图像名称
    ///  - parameter backImageName: 背景图像名称
    ///
    ///  - returns: UIButton
    
    convenience init(imageName:String,backImageName:String){
        
        self.init()
        setImage(UIImage(named: imageName), forState: .Normal)
        setImage(UIImage(named: imageName + "_highlighted"), forState: .Highlighted)
        setBackgroundImage(UIImage(named: backImageName), forState: .Normal)
        setBackgroundImage(UIImage(named: backImageName + "_highlighted"), forState: .Highlighted)
        sizeToFit()
        
    }
    
    ///  便利构造函数
    ///
    ///  - parameter title:    title
    ///  - parameter color:    color
    ///  - parameter imgeName: imgName
    ///
    ///  - returns: <#return value description#>
    
    convenience init(title:String,color:UIColor,imgeName:String){
    
       self.init()
        
       setTitle(title, forState: .Normal)
       setTitleColor(color, forState: .Normal)
        
       setBackgroundImage(UIImage(named: imgeName), forState: .Normal)
        
    }
    
    
    
}